package com.lry.dao;

import com.lry.bean.User;

import org.apache.ibatis.jdbc.SQL;
import org.springframework.util.StringUtils;

/**
 * 
 *
 * @author 李瑞益
 * @date 2019/8/20
 */
public class UserSqlProvider {

    public String addUser(User user) {
        SQL sql = new SQL();
        sql.INSERT_INTO("user");
        if (!StringUtils.isEmpty(user.getName())) {
            sql.VALUES("username","#{username,jdbcType=VARCHAR}");
        }
        if (!StringUtils.isEmpty(user.getPassword())) {
            sql.VALUES("password","#{password,jdbcType=VARCHAR}");
        }
        sql.VALUES("state","0");
        return sql.toString();
    }
}
